<?php

use yii\helpers\Html;
use kartik\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\modules\logs\models\ApiSendToBankLoggSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '本api请求工行记录';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="api-send-to-bank-log-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'id',
//            [
//                'attribute'=>'idno',
//                'value' => function($model, $key, $index, $column){
//                    $post_data = unserialize($model->post_data);
//                    $req = $post_data['req'];
//                    $req =json_decode($req);
//                    $customer = $req->customer;
////                    Yii::trace($customer, 'wodrow');
//                    return $customer->idno;
//                }
//            ],
//            'time:datetime',
            [
                'attribute'=>'time',
                'format' => ['date', 'php:Y-m-d H:i:s'],
                'filterType' => \kartik\grid\GridView::FILTER_DATE_RANGE,
                'filterWidgetOptions' =>[
                    'model'=>$searchModel,
                    'attribute'=>'time',
                    'presetDropdown'=>TRUE,
                    'convertFormat'=>true,
                    'pluginOptions'=>[
                        'format'=>'Y-m-d',
                        'opens'=>'left',
                        'locale' => [
                            'cancelLabel' => 'Clear',
                            'format' => 'Y-m-d',
                        ],
                    ]
                ],
            ],
            [
                'class' => \kartik\grid\ActionColumn::className(),
            ],
            [
                'class' => \kartik\grid\ExpandRowColumn::className(),
                'width' => '50px',
                'value' => function ($model, $key, $index, $column) {
                    return \kartik\grid\GridView::ROW_COLLAPSED;
                },
                'detail' => function ($model, $key, $index, $column) {
                    return Yii::$app->controller->renderPartial('detail', ['model'=>$model, 'id'=>$key]);
                },
                'headerOptions' => ['class' => 'kartik-sheet-style'],
                'expandOneOnly' => true,
                'pageSummary'=>'总计',//可以是字符串，当为true时，自动合计
            ],
            'header_data:ntext',
            'get_data',
            'post_data',
            'return_content',
            'other_data',
        ],
    ]); ?>
</div>
